/**
 * 
 */
package json;

import java.util.ArrayList;
import java.util.List;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

/**
 * @author Administrator
 *
 */
public class J1 {

	public static void main(String[] argv)
	{
		boolean[] boolArray = new boolean[]{true,false,true};  
		JSONArray jsonArray = JSONArray.fromObject( boolArray );  
		System.out.println( jsonArray );  
		// prints [true,false,true]j
		
		List list = new ArrayList();  
		list.add( "first" );  
		list.add( "second" );  
		JSONArray jsonArray2 = JSONArray.fromObject( list );  
		System.out.println( jsonArray2 );  
		// prints ["first","second"]
		
		JSONArray jsonArray3 = JSONArray.fromObject( "['json','is','easy']" );  
		System.out.println( jsonArray3 );  
		// prints ["json","is","easy"]
		
		String json = "{name=\"json\",bool:true,int:1,double:2.2,func:function(a){ return a; },array:[1,2]}";      
		JSONObject jsonObject4 = JSONObject.fromObject(json);   
		
		System.out.println(jsonObject4.getJSONArray("array"));
	}
}
